package lxs.tool.liberator.work.controller;

import lxs.tool.liberator.common.base.result.Response;
import lxs.tool.liberator.work.param.out.ParamTree;
import lxs.tool.liberator.work.service.ParamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("work/param")
public class ParamController {
    @Autowired
    private ParamService paramService;

    @GetMapping("showTable")
    public Response showTable() throws Exception {
        return paramService.showTable();
    }

    @GetMapping("showTree")
    public Response showTree() throws Exception {
        return paramService.showTree();
    }


    @GetMapping("getOptions")
    public Response getOptions() {
        return paramService.getOptions();
    }

    @GetMapping("getFuncOptions")
    public Response getFuncOptions() {
        return paramService.getFuncOptions();
    }

    @GetMapping("showAll")
    public Response showAll() {
        return paramService.showAll();
    }

    @PostMapping("saveTree")
    public Response saveTree(@RequestBody List<ParamTree> treeList) {
        return paramService.saveTree(treeList);
    }

    @GetMapping("getTypeOptions")
    public Response getTypeOptions() {
        return paramService.getTypeOptions();
    }

    @GetMapping("deleteById")
    public Response deleteById(String id) {
        return paramService.deleteById(id);
    }

}
